// 242. 有效的字母异位词

function isAnagram(s: string, t: string): boolean {
  const cnt: number[] = new Array(26).fill(0);
  const a = "a".charCodeAt(0);
  for (const c of s) {
    cnt[c.charCodeAt(0) - a]++;
  }

  for (const ch of t) {
    cnt[ch.charCodeAt(0) - a]--;
  }

  return cnt.every((item) => !item);
}
